package com.zufe.khw;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.Locale;

public class Test4 {
    public static void main(String[] args) throws ParseException {
        String birthDay = "2003年07月23日";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        Date birthDate = sdf.parse(birthDay);
        long birthTime = birthDate.getTime();
        long nowTime = System.currentTimeMillis();
        long lifeTime = (nowTime - birthTime) / 1000 / 60 / 60 / 24;
        System.out.println("你已经活了" + lifeTime + "天");
        LocalDate ld1 = LocalDate.now();
        LocalDate ld2 = LocalDate.of(2003, 7, 23);
        long days = ChronoUnit.DAYS.between(ld2, ld1);
        System.out.println(days + "天");
    }
}
